import Vue from "vue";
import { Dialog } from "vant";
import moment from "moment";
import "vant/lib/index.less";
import App from "./App.vue";
import store from "./store";
import router from "./router";

Vue.prototype.$moment = moment;
// use : this.$moment(item.loginAt).format('YYYY-MM-DD HH:mm:ss')
// this.$moment(this.form.startTime).toISOString()

Vue.use(Dialog);

/*全局加载axios拦截器---配置axios的原型链*/
import "./api/axios";

import queryString from "query-string";
// https://localhost:3000/?phone=12345678911&mid=TT-0C001010&model=&status=
const parsed = queryString.parse(location.href.split("?")[1]);
console.log(parsed);
if (parsed["phone"]) {
    localStorage.setItem("phoneNumber", parsed["phone"]);
} else {
    localStorage.setItem("phoneNumber", "");
}
if (parsed["mid"]) {
    localStorage.setItem("mindray-mid", parsed["mid"]);
}
if (parsed["openid"]) {
    localStorage.setItem("openid", parsed["openid"]);
}
if (parsed["model"]) {
    localStorage.setItem("mindray-mode", parsed["model"]);
}
if (parsed["status"] && parsed["scan"] === "true") {
    localStorage.setItem("mindray-status", parsed["status"]);
}

Vue.config.productionTip = false;

new Vue({
    router,
    store,
    render: (h) => h(App),
}).$mount("#app");
